create table TravelGuide
(
	 [TravelGuideId] int identity(1, 1) primary key
	,[Avatar] nvarchar(128)
	,[FullName] nvarchar(128)
	,[Birthday] datetime
	,[Gender] nvarchar(8)
	,[Phone] varchar(32)
	,[Email] nvarchar(128)
	,[Info] nvarchar(max)
	,[IdentityCard] varchar(32)
	,[Level] int
	,[Languages] varchar(128)
	,[Facebook] nvarchar(128)
	,[GooglePlus] nvarchar(128)
	,[Twitter] nvarchar(128)
	,[ContinentId] int
	,[NationalId] int
	,[CityId] int
	,[DistrictId] int
	,[WardId] int
	,[Address] nvarchar(256)
	,[CreatedBy] int
	,[CreatedDate] datetime
	,[UpdatedBy] int
	,[UpdatedDate] datetime
	,[Status] int
)
go

ALTER PROCEDURE TravelGuideGet
	@TravelGuideId int
AS
SELECT *
FROM [TravelGuide]
WHERE [TravelGuide].[TravelGuideId] = @TravelGuideId
GO

ALTER PROCEDURE TravelGuideList
AS
SELECT *
FROM [TravelGuide]
ORDER BY TravelGuideId DESC
GO

ALTER PROCEDURE TravelGuideInsert
	 @Avatar nvarchar(128)
	,@FullName nvarchar(128)
	,@Birthday datetime
	,@Gender nvarchar(8)
	,@Phone varchar(32)
	,@Email nvarchar(128)
	,@Info nvarchar(max)
	,@IdentityCard varchar(32)
	,@Level int
	,@Languages varchar(128)
	,@Facebook nvarchar(128)
	,@GooglePlus nvarchar(128)
	,@Twitter nvarchar(128)
	,@ContinentId int
	,@NationalId int
	,@CityId int
	,@DistrictId int
	,@WardId int
	,@Address nvarchar(256)
	,@CreatedBy int
	,@CreatedDate datetime
	,@UpdatedBy int
	,@UpdatedDate datetime
	,@Status int
AS

INSERT INTO TravelGuide (
	 [Avatar]
	,[FullName]
	,[Birthday]
	,[Gender]
	,[Phone]
	,[Email]
	,[Info]
	,[IdentityCard]
	,[Level]
	,[Languages]
	,[Facebook]
	,[GooglePlus]
	,[Twitter]
	,[ContinentId]
	,[NationalId]
	,[CityId]
	,[DistrictId]
	,[WardId]
	,[Address]
	,[CreatedBy]
	,[CreatedDate]
	,[UpdatedBy]
	,[UpdatedDate]
	,[Status]
	
) VALUES (
	 @Avatar
	,@FullName
	,@Birthday
	,@Gender
	,@Phone
	,@Email
	,@Info
	,@IdentityCard
	,@Level
	,@Languages
	,@Facebook
	,@GooglePlus
	,@Twitter
	,@ContinentId
	,@NationalId
	,@CityId
	,@DistrictId
	,@WardId
	,@Address
	,@CreatedBy
	,@CreatedDate
	,@UpdatedBy
	,@UpdatedDate
	,@Status
	
)

select SCOPE_IDENTITY()
GO

ALTER PROCEDURE TravelGuideUpdate
	@TravelGuideId int, 
	@Avatar nvarchar(128), 
	@FullName nvarchar(128), 
	@Birthday datetime, 
	@Gender nvarchar(8), 
	@Phone varchar(32), 
	@Email nvarchar(128), 
	@Info nvarchar(max), 
	@IdentityCard varchar(32), 
	@Level int, 
	@Languages varchar(128), 
	@Facebook nvarchar(128), 
	@GooglePlus nvarchar(128), 
	@Twitter nvarchar(128),
	@ContinentId int,
	@NationalId int,
	@CityId int,
	@DistrictId int,
	@WardId int,
	@Address nvarchar(256),
	@CreatedBy int, 
	@CreatedDate datetime, 
	@UpdatedBy int, 
	@UpdatedDate datetime, 
	@Status int 

AS

UPDATE TravelGuide SET
	    [Avatar] = @Avatar
	   ,[FullName] = @FullName
	   ,[Birthday] = @Birthday
	   ,[Gender] = @Gender
	   ,[Phone] = @Phone
	   ,[Email] = @Email
	   ,[Info] = @Info
	   ,[IdentityCard] = @IdentityCard
	   ,[Level] = @Level
	   ,[Languages] = @Languages
	   ,[Facebook] = @Facebook
	   ,[GooglePlus] = @GooglePlus
	   ,[Twitter] = @Twitter
	   ,[ContinentId] = @ContinentId
	   ,[NationalId] = @NationalId
	   ,[CityId] = @CityId
	   ,[DistrictId] = @DistrictId
	   ,[WardId] = @WardId
	   ,[Address] = @Address
	   ,[CreatedBy] = @CreatedBy
	   ,[CreatedDate] = @CreatedDate
	   ,[UpdatedBy] = @UpdatedBy
	   ,[UpdatedDate] = @UpdatedDate
	   ,[Status] = @Status
WHERE [TravelGuide].[TravelGuideId] = @TravelGuideId
GO

ALTER PROCEDURE TravelGuideDelete
	@TravelGuideId int
AS
DELETE FROM TravelGuide
WHERE [TravelGuide].[TravelGuideId] = @TravelGuideId
GO